#include <iostream>
using namespace std;
int yueshu(int, int);
int beishu(int, int, int);
int main() {
    int a, b;
    cout << "Please input two number:";
    cin >> a >> b;
    int c = yueshu(a, b);
    cout << "最大公约数是:" << c << endl;
    int d = beishu(a, b, c);
    cout << "最小公倍数:" << d << endl;
    return 0;
}

int yueshu(int m, int n) {
    int i, yueshu;
    i = m < n ? m : n;
    for (; i >= 1; i--) {
        if (m % i == 0 && n % i == 0) {
            yueshu = i;
            break;
        }
    }
    return i;
}

int beishu(int x, int y, int z) {
    return x * y / z;
}
